-- @owner: lihongji
-- @date: 2022/07/29
-- @testpoint: order by 各种数据类型-二进制

--step1:建序列;expect:成功
drop sequence if exists v_seq;
create sequence v_seq increment by 1 start with 10000;

--step2:建表并插入数据;expect:成功
drop table if exists t_percent_rank_004;
create table t_percent_rank_004(col_1 bigint, col_2 timestamp, col_3 bool,col_4 decimal,col_5 clob ,
col_6 interval day to second ,col_7 nchar(30) ,col_8 blob ,col_9 raw(100),col_10 date,
col_11 bytea ,col_12 bytea,col_13 varchar2(800)) with (storage_type=ustore);

insert into t_percent_rank_004 values(
v_seq.nextval,to_date('2019-09-05 10:45:42', 'yyyy-mm-dd hh:mi:ss'),'true',3.141592665735674554784786,lpad('abc','50','a@123&^%djgk'),
(interval '4 5:12:10.222' day to second(3)),rpad('abc','30','uegc%^4'),'101001010','0faadb9',to_date('1981-2-20', 'yyyy-mm-dd'),
'101001010','01010111111110000000000',lpad('jhafd韩子高各机构测','80','ajge'));
insert into t_percent_rank_004 values(
v_seq.nextval,to_date('2019-09-06 10:45:42', 'yyyy-mm-dd hh:mi:ss'),'true',3.141592665735674554784787,lpad('abc','55','a@123&^%djgk'),
(interval '4 5:12:10.222' day to second(3)),rpad('ab','30','uegc%^4'),'101010101010','0faadb9',to_date('1981-2-21', 'yyyy-mm-dd'),
'1001010101010','01010111111110000000001100000',lpad('jhafd韩子高各机构测','82','ajgedf'));
insert into t_percent_rank_004 values(
v_seq.nextval,to_date('2019-09-07 10:45:42', 'yyyy-mm-dd hh:mi:ss'),'true',3.141592665735674554784788,lpad('abc','100','a@123&^%djgk'),
(interval '4 5:12:10.222' day to second(3)),rpad('abc','29','uegc%^4'),'101010101010','0faadb9',to_date('1981-3-20', 'yyyy-mm-dd'),
'1010100101010','010101111111100000000011100000',lpad('jhafd韩子高各机构测','81','ajge'));
insert into t_percent_rank_004 values(
v_seq.nextval,to_date('2019-09-08 10:45:42', 'yyyy-mm-dd hh:mi:ss'),'false',3.141592665735674554784789,lpad('abc','500','a@123&^%djgk'),
(interval '4 5:12:10.222' day to second(3)),rpad('abc','28','uegc%^4'),'1010101001010','0faadb9',to_date('1981-3-21', 'yyyy-mm-dd'),
'10101001010111','010101111111100000000000000',lpad('jhafd韩子高各机构测','185','ajge'));

insert into t_percent_rank_004 values(
v_seq.nextval,to_date('2019-09-05 10:45:42', 'yyyy-mm-dd hh:mi:ss'),'true',3.1415926657356745547847861,lpad('abc','20','a@123&^%djgk'),
(interval '4 5:13:10.222' day to second(3)),rpad('abc','30','uegc%^4'),empty_blob(),'0faadb9',to_date('1981-2-20', 'yyyy-mm-dd'),
'10101001010','01010111111110000000000',lpad('jhafd韩子h高各机构测','80','ajge'));
insert into t_percent_rank_004 values(
v_seq.nextval,to_date('2019-09-06 10:45:42', 'yyyy-mm-dd hh:mi:ss'),null,3.1415926657356745547847870,lpad('abc','55','a@123&^%djgk'),
(interval '5 5:12:10.222' day to second(2)),rpad('ab','30','uegc%^4'),'10101001010','0faadb9',to_date('1981-2-21', 'yyyy-mm-dd'),
'101010010101','01010111111110000000001100000',lpad('jhafd韩子#￥%……￥……%*','82','ajgedf'));
insert into t_percent_rank_004 values(
v_seq.nextval,to_date('2019-09-07 10:45:42', 'yyyy-mm-dd hh:mi:ss'),'false',3.1415926657356745547847880,lpad('abc','30','a@123&^%djgk'),
(interval '4 5:10:10.222' day to second(2)),rpad('abc','29','uegc%^4'),'10101001010','0faadb9',to_date('1981-3-20', 'yyyy-mm-dd'),
'1010100101010','01010111111110000000001100000',lpad('jhafd韩子高各机构测','81','ajge'));
insert into t_percent_rank_004 values(
v_seq.nextval,to_date('2019-09-08 10:45:42', 'yyyy-mm-dd hh:mi:ss'),'false',3.1415926657356745547847890,lpad('abc','500','a@123&^%djgk'),
(interval '6 5:11:10.222' day to second(4)),rpad('abc','28','uegc%^4'),empty_blob(),'0faadb9',to_date('1981-3-21', 'yyyy-mm-dd'),
'10101001010111','010101111111100000000000000',lpad('江苏高考覆盖扩容','185','ajge'));

insert into t_percent_rank_004 values(
v_seq.nextval,null,'true',null,lpad('abc','50','a@123&^%djgk'),
(interval '4 5:12:10.222' day to second(3)),rpad('abc','30','uegc%^4'),'10101001010','0faadb923',null,
'10101001010','01010111111110000000000',null);
insert into t_percent_rank_004 values(
v_seq.nextval,to_date('2019-09-06 10:45:42', 'yyyy-mm-dd hh:mi:ss'),'true',null,lpad('abc','55','a@123&^%djgk'),
(interval '4 5:12:10.222' day to second(3)),rpad('ab','30','uegc%^4'),'10101001010',null,to_date('1982-2-21', 'yyyy-mm-dd'),
'101010010101',null,lpad('韩子高各机构测','82','ajgedf'));
insert into t_percent_rank_004 values(
v_seq.nextval,to_date('2019-09-07 10:45:42', 'yyyy-mm-dd hh:mi:ss'),null,3.1415926657356745547847884,lpad('abc','100','a@123&^%djgk'),
null,rpad('abc','29','uegc%^4'),'10101001010','0faadb900',to_date('1981-3-20', 'yyyy-mm-dd'),
null,'010101111111100000000011100000',lpad('jhafd韩子高各机构测','81','ajge'));
insert into t_percent_rank_004 values(
v_seq.nextval,to_date('2019-09-08 10:45:42', 'yyyy-mm-dd hh:mi:ss'),'false',3.141592665735674554784789,null,
(interval '4 5:12:10.222' day to second(3)),null,'10101001010','0faadb9011',null,
'101001010111','010101111111100000000000000',lpad('abc','35','a@123&^%djgk'));
insert into t_percent_rank_004(col_1) values(v_seq.nextval-1);
insert into t_percent_rank_004(col_9) values(null);

--step3:查询;expect:成功
select col_1,col_11,percent_rank() over(order by col_11) f1 from t_percent_rank_004 order by col_11,f1,col_1;

select col_1,col_12,percent_rank() over(order by col_12) f1 from t_percent_rank_004 order by col_12,f1,col_1;

select col_1,lengthb(col_13),percent_rank() over(order by col_13) f1 from t_percent_rank_004 order by col_13,f1,col_1;

--step4:清理环境;expect:成功
drop sequence if exists v_seq;
drop table if exists t_percent_rank_004;